
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./templates/template_acheteur.xhtml"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:c="http://java.sun.com/jsp/jstl/core">

    <ui:define name="content">
        <f:view>
            <c:if test="${userBean.acheteurConnected == false}">
                Veuillez vous connecter pour accéder à cette partie
            </c:if>
            <c:if test="${userBean.acheteurConnected == true}">
                <p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
                <h:form>
                    <h1><h:outputText value="Mon panier"/></h1>
                    <p:dataTable value="#{userBean.lazyPanier}" 
                                 var="val"
                                 rows="10"
                                 paginator="true"
                                 rowsPerPageTemplate="5,10,15"
                                 paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
                                 id="DTTableLazy"
                                 lazy="true"
                                 >
                        <p:column headerText="Nom" style="width: 180px; text-align: center;">
                            <h:outputText value="#{val.nom}"/>
                        </p:column>
                        <p:column headerText="Description">
                            <h:outputText value="#{val.description}"/>
                        </p:column>
                        <p:column headerText="Catégorie" style="width: 160px; text-align: center;">
                            <h:outputText value="#{val.categorie}"/>
                        </p:column>
                        <p:column headerText="Vendeur" style="width: 200px; text-align: center;">
                            <h:outputText value="#{val.magasin.proprio.prenom} #{val.magasin.proprio.nom}"/>
                        </p:column>
                        <p:column headerText="Prix" style="width: 120px; text-align: center;">
                            <h:outputText value="#{val.prix} €"/>
                        </p:column>
                        <p:column headerText="E-Mall" style="width: 100px; text-align: center;" >
                            <h:commandLink action="#{magasinBean.enleverPanier(val)}" value="Supprimer" ></h:commandLink>
                        </p:column>
                    </p:dataTable>
                </h:form>
            </c:if>
        </f:view>
    </ui:define>
</ui:composition>
